<?php 
//控制基类  基类控制继承模板引擎


class Controller extends Smarty
{
	public function __construct(){
		$this->setTemplateDir('./views')          //模板文件
		        ->setCompileDir('./runtime/views_c') // 编译文件
		        ->setConfigDir('./configs')         // 配置文件
		        ->setCacheDir('./runtime/views_c');  // 缓存文件
		$this->left_delimiter = "<{";
		$this->right_delimiter = "}>";
		$this->caching = false;
		$this->cache_lifetime = 30;

	}
	public function __call($fun, $params)
	{
	    header("HTTP/1.0 404 not found");
	    echo '<h1>404 NOT FOUND: 来自于控制基类</h1>';
	    exit;
	}
	//跳转重定向
	public function redirect($message, $url=null)
	    {
	        echo "<script>alert('{$message}')</script>";
	        if (empty($url)) {
	            echo "<script>history.back()</script>";
	        }else{
	            echo "<script>location.href='{$url}'</script>";
	        }
	    }
	    
   
}



